/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package slcu.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import slcu.model.Coordinador;
import slcu.model.CoordinadorModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the Coordinador service. Represents a row in the &quot;SLCU_Coordinadores&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link slcu.model.CoordinadorModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link CoordinadorImpl}.
 * </p>
 *
 * @author tito
 * @see CoordinadorImpl
 * @see slcu.model.Coordinador
 * @see slcu.model.CoordinadorModel
 * @generated
 */
public class CoordinadorModelImpl extends BaseModelImpl<Coordinador>
	implements CoordinadorModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a Coordinador model instance should use the {@link slcu.model.Coordinador} interface instead.
	 */
	public static final String TABLE_NAME = "SLCU_Coordinadores";
	public static final Object[][] TABLE_COLUMNS = {
			{ "coordinadorId", Types.BIGINT },
			{ "nombre", Types.VARCHAR },
			{ "region", Types.VARCHAR },
			{ "mail", Types.VARCHAR }
		};
	public static final String TABLE_SQL_CREATE = "create table SLCU_Coordinadores (coordinadorId LONG not null primary key,nombre VARCHAR(75) null,region VARCHAR(75) null,mail VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table SLCU_Coordinadores";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.slcu.model.Coordinador"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.slcu.model.Coordinador"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.column.bitmask.enabled.slcu.model.Coordinador"),
			true);
	public static long MAIL_COLUMN_BITMASK = 1L;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.slcu.model.Coordinador"));

	public CoordinadorModelImpl() {
	}

	public long getPrimaryKey() {
		return _coordinadorId;
	}

	public void setPrimaryKey(long primaryKey) {
		setCoordinadorId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_coordinadorId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return Coordinador.class;
	}

	public String getModelClassName() {
		return Coordinador.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("coordinadorId", getCoordinadorId());
		attributes.put("nombre", getNombre());
		attributes.put("region", getRegion());
		attributes.put("mail", getMail());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long coordinadorId = (Long)attributes.get("coordinadorId");

		if (coordinadorId != null) {
			setCoordinadorId(coordinadorId);
		}

		String nombre = (String)attributes.get("nombre");

		if (nombre != null) {
			setNombre(nombre);
		}

		String region = (String)attributes.get("region");

		if (region != null) {
			setRegion(region);
		}

		String mail = (String)attributes.get("mail");

		if (mail != null) {
			setMail(mail);
		}
	}

	public long getCoordinadorId() {
		return _coordinadorId;
	}

	public void setCoordinadorId(long coordinadorId) {
		_coordinadorId = coordinadorId;
	}

	public String getNombre() {
		if (_nombre == null) {
			return StringPool.BLANK;
		}
		else {
			return _nombre;
		}
	}

	public void setNombre(String nombre) {
		_nombre = nombre;
	}

	public String getRegion() {
		if (_region == null) {
			return StringPool.BLANK;
		}
		else {
			return _region;
		}
	}

	public void setRegion(String region) {
		_region = region;
	}

	public String getMail() {
		if (_mail == null) {
			return StringPool.BLANK;
		}
		else {
			return _mail;
		}
	}

	public void setMail(String mail) {
		_columnBitmask |= MAIL_COLUMN_BITMASK;

		if (_originalMail == null) {
			_originalMail = _mail;
		}

		_mail = mail;
	}

	public String getOriginalMail() {
		return GetterUtil.getString(_originalMail);
	}

	public long getColumnBitmask() {
		return _columnBitmask;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			Coordinador.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public Coordinador toEscapedModel() {
		if (_escapedModelProxy == null) {
			_escapedModelProxy = (Coordinador)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelProxyInterfaces,
					new AutoEscapeBeanHandler(this));
		}

		return _escapedModelProxy;
	}

	@Override
	public Object clone() {
		CoordinadorImpl coordinadorImpl = new CoordinadorImpl();

		coordinadorImpl.setCoordinadorId(getCoordinadorId());
		coordinadorImpl.setNombre(getNombre());
		coordinadorImpl.setRegion(getRegion());
		coordinadorImpl.setMail(getMail());

		coordinadorImpl.resetOriginalValues();

		return coordinadorImpl;
	}

	public int compareTo(Coordinador coordinador) {
		long primaryKey = coordinador.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		Coordinador coordinador = null;

		try {
			coordinador = (Coordinador)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = coordinador.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
		CoordinadorModelImpl coordinadorModelImpl = this;

		coordinadorModelImpl._originalMail = coordinadorModelImpl._mail;

		coordinadorModelImpl._columnBitmask = 0;
	}

	@Override
	public CacheModel<Coordinador> toCacheModel() {
		CoordinadorCacheModel coordinadorCacheModel = new CoordinadorCacheModel();

		coordinadorCacheModel.coordinadorId = getCoordinadorId();

		coordinadorCacheModel.nombre = getNombre();

		String nombre = coordinadorCacheModel.nombre;

		if ((nombre != null) && (nombre.length() == 0)) {
			coordinadorCacheModel.nombre = null;
		}

		coordinadorCacheModel.region = getRegion();

		String region = coordinadorCacheModel.region;

		if ((region != null) && (region.length() == 0)) {
			coordinadorCacheModel.region = null;
		}

		coordinadorCacheModel.mail = getMail();

		String mail = coordinadorCacheModel.mail;

		if ((mail != null) && (mail.length() == 0)) {
			coordinadorCacheModel.mail = null;
		}

		return coordinadorCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(9);

		sb.append("{coordinadorId=");
		sb.append(getCoordinadorId());
		sb.append(", nombre=");
		sb.append(getNombre());
		sb.append(", region=");
		sb.append(getRegion());
		sb.append(", mail=");
		sb.append(getMail());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(16);

		sb.append("<model><model-name>");
		sb.append("slcu.model.Coordinador");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>coordinadorId</column-name><column-value><![CDATA[");
		sb.append(getCoordinadorId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>nombre</column-name><column-value><![CDATA[");
		sb.append(getNombre());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>region</column-name><column-value><![CDATA[");
		sb.append(getRegion());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>mail</column-name><column-value><![CDATA[");
		sb.append(getMail());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = Coordinador.class.getClassLoader();
	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
			Coordinador.class
		};
	private long _coordinadorId;
	private String _nombre;
	private String _region;
	private String _mail;
	private String _originalMail;
	private long _columnBitmask;
	private Coordinador _escapedModelProxy;
}